package com.css.dzj.dzjportal.common.menu;

import com.alibaba.fastjson.JSON;
import com.css.aq.server.service.BaseService;
import com.css.dzj.dzjportal.common.util.R;
import com.css.dzj.dzjportal.common.util.ServiceUtil;
import com.css.dzj.dzjportal.sys.user.entity.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/sys")
public class GetSysController {
    @Autowired
    private BaseService baseService;
    @Autowired
    private HttpServletRequest request;
    @GetMapping("/getsys")
    public R getSys(){
        HttpSession session=request.getSession();
        LoginUser userInfo = (LoginUser) session.getAttribute("_USER_LOGIN_INFO_");
        List<Map<String,Object>> sysApp = userInfo.getSysApp();
       /* String id= ServiceUtil.getUserId(request);
        Long userId=Long.parseLong(id);
        Map map=baseService.listAppByUserId(userId);
        ;*/
        //String data= JSON.toJSONString(sysApp);
        return R.ok().put("data",sysApp);
    }
}
